
=[public: init code ]

parser function _getarg {
	match { ($W:ANAME : $TYPE ; $REST) } {
		emit  {
			_funcarg {$ANAME} {$TYPE} 
			_getarg ($REST)
		}
		return 
	}
	match { ($W:ANAME : $TYPE) } {
		emit  { 
			_funcarg {$ANAME} {$TYPE} 
		}
		return 
	}
	print "no match for '_getarg'\n"
	fail
}

parser function function {
	match { $W:NAME ($ARGS) returns $TYPE {$BODY} } {
		emit { _beginfuncwreturn {$NAME} {$TYPE}
				_getarg ($ARGS) 
			_endfunc {$BODY} }
		return 
	}
	match { $W:NAME ($ARGS) {$BODY} } {
		emit { _beginfunc {$NAME} _getarg ($ARGS) 
			_endfunc {$BODY} }
		return
	}
	print "no match for 'function'\n"
	fail
}

print "standard library loaded\n"
